package exttable.testselector;

import javax.swing.table.AbstractTableModel;
import java.util.Vector;

/**
 * Created by IntelliJ IDEA.
 * User: Admin
 * Date: Jan 15, 2010
 * Time: 12:17:11 AM
 * To change this template use File | Settings | File Templates.
 */
public class TimeTableModel extends AbstractTableModel {
    private Vector<Vector> timeTableData;
    private Vector<String> timeTableHeader;

    public TimeTableModel() {
    }

    public TimeTableModel(Vector<Vector> timeTableData, Vector<String> timeTableHeader) {
        this.timeTableData = timeTableData;
        this.timeTableHeader = timeTableHeader;
    }

    public Vector<Vector> getTimeTableData() {
        return timeTableData;
    }

    public Vector<String> getTimeTableHeader() {
        return timeTableHeader;
    }

    @Override
    public int getRowCount() {
        return timeTableData.size();
    }

    @Override
    public int getColumnCount() {
        return timeTableHeader.size();
    }

    @Override
    public Object getValueAt(int rowIndex, int columnIndex) {
        Vector v = timeTableData.get(rowIndex);
        return v.get(columnIndex);
    }

    @Override
    public String getColumnName(int column) {
       return timeTableHeader.get(column);
    }

    @Override
    public boolean isCellEditable(int rowIndex, int columnIndex) {
       return columnIndex != 0;
    }
    
}
